import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      path: "/",
      redirect: "/index",
    },
    {
      path: "/login",
      name: "Login",
      component: () => import("../pages/Login.vue"), //路由懒加载
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/register",
      name: "Register",
      component: () => import("../pages/Register.vue"),
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/sort",
      name: "Sort",
      component: () => import("../pages/Sort.vue"),
      meta: {
        showTabbar: true,
      },
    },
    {
      path: "/index",
      name: "Index",
      component: () => import("../pages/Index.vue"),
      meta: {
        showTabbar: true,
      },
    },

    {
      path: "/detail/:id",
      name: "Detail",
      component: () => import("../pages/Detail.vue"),
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/cart",
      name: "Cart",
      component: () => import("../pages/Cart.vue"),
      meta: {
        showTabbar: true,
      },
    },
    {
      path: "/my",
      name: "My",
      component: () => import("../pages/My.vue"),
      meta: {
        showTabbar: true,
      },
    },
    {
      path: "/edituser",
      name: "edituser",

      component: () => import("@/pages/edituser.vue"),
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/editpassword",
      name: "editpassword",

      component: () => import("@/pages/editpassword.vue"),
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/address",
      name: "Address",
      component: () => import("../pages/Address.vue"),
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/order",
      name: "Order",
      component: () => import("../pages/Order.vue"),
      meta: {
        showTabbar: false,
      },
    },
  ],
});

export default router;
